<template>
    <div id="right-bar" style="width: 100%; height: 430px"></div>
</template>
<script lang="ts">
import { defineComponent, onMounted, toRefs } from 'vue'
import Lodash from 'lodash'

import echarts from '@/echarts'

import { option } from './constant'

export default defineComponent({
    name: 'RightBar',
    setup() {
        const constant = {
            option
        }
        const state = {
            currentIndex: 0,
            oldIndex: '' as any,
            myChart: null as any
        }
        onMounted(() => {
            let { option } = constant
            state.myChart = echarts.init(document.getElementById('right-bar'))

            state.myChart.setOption(option)
        })

        return {
            ...toRefs(state),
            ...constant
        }
    }
})
</script>
